import axios from 'axios';
import BasicConfig from './BasicConfig'
const CLOUD_API = (window as any)['env'];
/**
 * 正射影像---保存点位接口
 */
export default class RequestOrthographic {
    public static SavePoint(
        data: any,
        event: (res: any) => void
    ) {
        axios.put(
            CLOUD_API.URL_REACT + "/api/point_info/edit",
            {
                ...data
            }
        ).then(
            res => event(res.data)
        ).catch(BasicConfig.RequestError)
    }
    /**
     * 获取点位
     * @param data 
     * @param event 
     */
    public static queryAll(
        event: (res: any) => void
    ) {
        axios.get(
            CLOUD_API.URL_REACT + "/api/point_info/query_all"
        ).then(
            res => event(res.data)
        ).catch(BasicConfig.RequestError)
    }
    /**
     * 删除点位
     * @param data 
     * @param event 
     */
    public static deletePoint(
        num: number, event: (res: any) => void
    ) {
        axios.delete(
            CLOUD_API.URL_REACT + "/api/point_info/delete/" + num
        ).then(
            res => event(res.data)
        ).catch(BasicConfig.RequestError)
    }
    /**
     * 删除点位
     * @param data 
     * @param event 
     */
    public static batchPoint(
        files: object, event: (res: any) => void
    ) {
        axios.post(
            CLOUD_API.URL_REACT + "/api/point_info/import_excel",
            files
        ).then(
            res => event(res.data)
        ).catch(BasicConfig.RequestError)
    }
}